/**
 * 返回分页data
 * @param current 当前页码
 * @param size 每页条数
 * @param count 总数
 * @param rows 当前页数据
 * @returns 
 */
export const getPageData = (current: string | number, size: string | number, count: number, rows: any[]) => {
  return {
    records: rows,
    total: count,
    size: Number(size),
    current: Number(current),
    pages: Math.ceil(count / Number(size))
  }
}

/**
 * 返回分页查询条件
 * @param current 当前页码
 * @param size 每页条数
 * @returns 
 */
export const getPageWhere = (current: string | number, size: string | number,) => {
  return {
    offset: (Number(current) - 1) * Number(size),
    limit: Number(size),
  }
}